package components;
import java.util.*;

import uml.Visitable;
import uml.Visitor;

public class Package implements Visitable {
	private String name;
	
	private HashMap<String,Class> classes = new HashMap<String,Class>();
	
	public void setClasses(HashMap<String, Class> classes) {
		this.classes = classes;
	}

	public Package(){}
	
	public Package(String name){
		this.name = name;
	}
	
	public String getName(){
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
		
	}
	
	public void addClass(Class _class){
		classes.put(_class.getName(), _class);
	}
	
	public Set<String> getClassNames(){
		return classes.keySet();
	}
	
	public ArrayList<Class> getClasses() {
		ArrayList<Class> ret = new ArrayList<Class>();
		Set<String> keys = classes.keySet();
		for(String s : keys){
			ret.add(classes.get(s));
		}
		return ret;
	}
	
	public Class getClass(String name){
		if(classes.containsKey(name)){
			return classes.get(name);
		}
		return null;
	}
	
	public String toString(){
		return name;
	}

	@Override
	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

	
}
